@using BTCPayServer.Client
@using BTCPayServer.Views.Stores
@model BTCPayServer.Models.WalletViewModels.NewPullPaymentModel
@{
    var storeId = Context.GetStoreData().Id;
    ViewData.SetLayoutModel(new(nameof(StoreNavPages.PullPayments), StringLocalizer["Create Pull Payment"]));
}

@section PageHeadContent {
    <link href="~/vendor/summernote/summernote-bs5.css" rel="stylesheet" asp-append-version="true"/>
}

@section PageFootContent {
    <partial name="_ValidationScriptsPartial"/>
    <script src="~/vendor/summernote/summernote-bs5.js" asp-append-version="true"></script>
}

<form method="post" asp-route-walletId="@Context.GetRouteValue("walletId")" asp-action="NewPullPayment">
    <div class="sticky-header">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">
                    <a asp-action="PullPayments" asp-route-storeId="@storeId" text-translate="true">Pull Payments</a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">@ViewData["Title"]</li>
            </ol>
            <h2>@ViewData["Title"]</h2>
        </nav>
		<input id="page-primary" type="submit" value="Create" class="btn btn-primary"/>
    </div>

    <partial name="_StatusMessage"/>

    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <label asp-for="Name" class="form-label"></label>
                <input asp-for="Name" class="form-control"/>
                <span asp-validation-for="Name" class="text-danger"></span>
            </div>
            <div class="row">
                <div class="form-group col-8">
                    <label asp-for="Amount" class="form-label" data-required></label>
                    <input asp-for="Amount" class="form-control" inputmode="decimal"/>
                    <span asp-validation-for="Amount" class="text-danger"></span>
                </div>
                <div class="form-group col-4">
                    <label asp-for="Currency" class="form-label"></label>
                    <input asp-for="Currency" class="form-control w-auto" currency-selection />
                    <span asp-validation-for="Currency" class="text-danger"></span>
                </div>

                <div class="form-group col-12" permission="@Policies.CanCreatePullPayments">
                    <div class="form-check ">
                        <input asp-for="AutoApproveClaims" type="checkbox" class="form-check-input"/>
                        <label asp-for="AutoApproveClaims" class="form-check-label"></label>
                        <span asp-validation-for="AutoApproveClaims" class="text-danger"></span>
                    </div>
                </div>
            </div>
            <div class="form-group mb-4">
                <label asp-for="PayoutMethods" class="form-label"></label>
                @foreach (var item in Model.PayoutMethodsItem)
                {
                    <div class="form-check mb-2">
                        <label class="form-label">
                            <input name="PayoutMethods" class="form-check-input" type="checkbox" value="@item.Value" @(item.Selected ? "checked" : "")>
                            @item.Text
                        </label>
                    </div>
                }
                <span asp-validation-for="PayoutMethods" class="text-danger mt-0"></span>
            </div>
        </div>
        <div class="col-lg-9">
            <div class="form-group mb-4">
                <label asp-for="Description" class="form-label"></label>
                <textarea asp-for="Description" class="form-control richtext"></textarea>
                <span asp-validation-for="Description" class="text-danger"></span>
            </div>

            <h4 class="mt-5 mb-2" text-translate="true">Additional Options</h4>
            <div class="form-group">
                <div class="accordion" id="additional">
                    <div class="accordion-item">
                        <h2 class="accordion-header" id="additional-lightning-header">
                            <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#additional-lightning" aria-expanded="false" aria-controls="additional-lightning">
                                <span text-translate="true">Lightning network settings</span>
                                <vc:icon symbol="caret-down" />
                            </button>
                        </h2>
                        <div id="additional-lightning" class="accordion-collapse collapse" aria-labelledby="additional-lightning-header">
                            <div class="accordion-body">
                                <div class="form-group">
                                    <label asp-for="BOLT11Expiration" class="form-label"></label>
                                    <div class="input-group">
                                        <input inputmode="numeric" asp-for="BOLT11Expiration" class="form-control" style="max-width:12ch;" />
                                        <span class="input-group-text" text-translate="true">days</span>
                                    </div>
                                    <span asp-validation-for="BOLT11Expiration" class="text-danger"></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
